<template>
  <div class="panel"></div>
</template>
<script>
import '/public/up6/panel/up6.css'
import {HttpUploaderMgr} from '/public/up6/panel/up6'
import $ from 'jquery'
export default {
  name: 'up6',
  props: {
    config: Object,
    fields: Object
  },
  data () {
    return {
      com: null
    }
  },
  mounted () {
    var _this = this
    this.com = new HttpUploaderMgr({
      Config: _this.config,
      Fields: _this.fields, // 赋加字段（业务参数）
      event: {// 绑定事件
        md5Complete: function (obj, md5) {
          /** 文件MD5计算完毕 */
          _this.$emit('md5_complete', obj, md5)
        },
        scanComplete: function (obj) {
          /** 目录扫描完毕 */
          _this.$emit('scan_complete', obj)
        },
        fileAppend: function (obj) {
          /** 添加文件或目录 */
          _this.$emit('file_append', obj)
        },
        fileComplete: function (obj) {
          /** 文件上传完毕 */
          _this.$emit('file_complete', obj)
        },
        fdComplete: function (obj) {
          /** 文件夹上传完毕 */
          _this.$emit('folder_complete', obj)
        },
        queueComplete: function () {
          /** 当前队列上传完毕 */
          _this.$emit('queue_complete')
        },
        ready: function () {
          /** 控件加载完毕 */
          _this.$emit('ready')
        }
      },
      ui: {
        container: $('.panel')// 加载到目标
      }
    })
  },
  methods: {}
}
</script>
